package edu.software.bookprojectclass.book.repository;

import edu.software.bookprojectclass.entity.Book;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;
@Repository
public interface BookRepository extends JpaRepository<Book, Integer> {
    public Book findById(int id);
    public List<Book> findByNameLike(String name);

    //为 true 表示使用原生 SQL 查询
    @Query(value = "select * from books", nativeQuery = true)
    public List<Book> findAll();
}
